import 'package:flutter/material.dart';

class RoundBoxTest extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('圆角矩形'),
      ),
      body: Container(
        alignment: Alignment.center,
        margin: EdgeInsets.all(10),
        child:  Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Text('boxdecoration圆角'),
            Container(
              width: 100,
              height: 100,
              decoration: BoxDecoration(
                  color: Colors.red,
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: AssetImage("images/itachi.jpg")
                  ),
                  borderRadius: BorderRadius.all(Radius.circular(5.0))
              ),
            ),
            SizedBox(height: 20,),
            Text('BoxDecoration 圆角对child'),
            Container(
              width: 100,
              height: 100,
              decoration: BoxDecoration(
                color: Colors.red,
                borderRadius: BorderRadius.all(Radius.circular(5.0))
              ),
              child: Image.asset(
                  'images/itachi.jpg',
                fit: BoxFit.cover,
                width: 100,
                height: 100,
              ),
            ),
            SizedBox(height: 20,),
            Text('ClipRRect 圆角对 child'),
            ClipRRect(
              borderRadius: BorderRadius.all(Radius.circular(5.0)),
              child: Image.asset('images/itachi.jpg',
                fit: BoxFit.cover,
                width: 100,
                height: 100,
              ),
            )
          ],

        ),
      )
    );
  }
}
